<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#33474d">
	<title>mydns安装配置 | 失落的乐章</title>
	<link rel="stylesheet" href="/css/style.css" />
	
      <link rel="alternate" href="/atom.xml" title="失落的乐章" type="application/atom+xml">
    
</head>

<body>

	<header class="header">
		<nav class="header__nav">
			
				<a href="/archives" class="header__link">Archive</a>
			
				<a href="/tags" class="header__link">Tags</a>
			
				<a href="/atom.xml" class="header__link">RSS</a>
			
		</nav>
		<h1 class="header__title"><a href="/">失落的乐章</a></h1>
		<h2 class="header__subtitle">技术面前，永远都是学生。</h2>
	</header>

	<main>
		<article>
	
		<h1>mydns安装配置</h1>
	
	<div class="article__infos">
		<span class="article__date">2017-10-12</span><br />
		
		
			<span class="article__tags">
			  	<a class="article__tag-link" href="/tags/DNS/">DNS</a>
			</span>
		
	</div>

	

	
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="http://mydns.bboy.net/download/mydns-1.1.0.tar.gz" target="_blank" rel="external">远程下载</a></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="http://www.apelearn.com/bbs/data/attachment/forum/month_1002/mydns-mysql-1.1.0-1.i386.rpm" target="_blank" rel="external">rpm包下载</a></p>
<h2 id="1-因为mydns依赖mysql，所以需要先安装mysql。"><a href="#1-因为mydns依赖mysql，所以需要先安装mysql。" class="headerlink" title="1.因为mydns依赖mysql，所以需要先安装mysql。"></a>1.因为mydns依赖mysql，所以需要先安装mysql。</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum install -y mysql-server</div></pre></td></tr></table></figure>
<h2 id="2-安装mydns"><a href="#2-安装mydns" class="headerlink" title="2 安装mydns"></a>2 安装mydns</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">wget  http://www.lishiming.net/data//a ... ql-1.1.0-1.i386.rpm</div><div class="line">rpm -ivh mydns-mysql-1.1.0-1.i386.rpm</div></pre></td></tr></table></figure>
<h2 id="3-创建库和表"><a href="#3-创建库和表" class="headerlink" title="3.创建库和表"></a>3.创建库和表</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">mysql -uroot  -e <span class="string">"create database mydns"</span></div><div class="line">mysql -uroot mydns</div><div class="line">mysql&gt; CREATE TABLE `soa` (   `id` int(10) unsigned NOT NULL auto_increment,   `origin` char(255) default NULL,   `ns` char(255) default NULL,   `mbox` char(255) default NULL,   `serial` int(10) unsigned default <span class="string">'1'</span>,   `refresh` int(10) unsigned default <span class="string">'28800'</span>,   `retry` int(10) unsigned default <span class="string">'7200'</span>,   `expire` int(10) unsigned default <span class="string">'604800'</span>,   `minimum` int(10) unsigned default <span class="string">'86400'</span>,   `ttl` int(10) unsigned default <span class="string">'86400'</span>,   `xfer` char(255) default NULL,   PRIMARY KEY  (`id`),   UNIQUE KEY `origin` (`origin`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=gbk;</div><div class="line"></div><div class="line">mysql&gt;  CREATE TABLE `rr` (   `id` int(10) unsigned NOT NULL auto_increment,   `zone` int(10) unsigned NOT NULL,   `name` char(64) default NULL,   `<span class="built_in">type</span>` enum(<span class="string">'A'</span>,<span class="string">'AAAA'</span>,<span class="string">'CNAME'</span>,<span class="string">'HINFO'</span>,<span class="string">'MX'</span>,<span class="string">'NAPTR'</span>,<span class="string">'NS'</span>,<span class="string">'PTR'</span>,<span class="string">'RP'</span>,<span class="string">'SRV'</span>,<span class="string">'TXT'</span>) default NULL,   `data` char(128) default NULL,   `aux` int(10) unsigned NOT NULL,   `ttl` int(10) unsigned NOT NULL default <span class="string">'600'</span>,   `inter` tinyint(3) unsigned NOT NULL default <span class="string">'1'</span>,   `intra` tinyint(3) unsigned NOT NULL default <span class="string">'1'</span>,   PRIMARY KEY  (`id`),   KEY `name` (`name`),   KEY `rr` (`zone`,`name`,`<span class="built_in">type</span>`,`data`) ) ENGINE=MyISAM AUTO_INCREMENT=1437896 DEFAULT CHARSET=gbk;</div></pre></td></tr></table></figure>
<h2 id="4-创建第一个zone"><a href="#4-创建第一个zone" class="headerlink" title="4.创建第一个zone"></a>4.创建第一个zone</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">mysql&gt; use mydns</div><div class="line">mysql&gt; insert into soa (id, origin,ns,mbox,serial,refresh,retry,expire,minimum,ttl) values(1,<span class="string">'abc.com.'</span>, <span class="string">'ns.abc.com.'</span>,  <span class="string">'root.aminglinux.com'</span>, 1, 28800, 7200, 604800, 86400, 86400);</div><div class="line">mysql&gt; insert into rr values(1, 1, <span class="string">'www'</span>, <span class="string">'A'</span>, <span class="string">'1.1.1.1'</span>, 0, 1, 1, 1, 1);</div></pre></td></tr></table></figure>
<h2 id="5-配置"><a href="#5-配置" class="headerlink" title="5.配置"></a>5.配置</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div></pre></td><td class="code"><pre><div class="line">mysql&gt; show create table soa\G;</div><div class="line"></div><div class="line"></div><div class="line">CREATE TABLE `soa` (   `id` int(10) unsigned NOT NULL auto_increment,   `origin` char(255) default NULL,   `ns` char(255) default NULL,   `mbox` char(255) default NULL,   `serial` int(10) unsigned default <span class="string">'1'</span>,   `refresh` int(10) unsigned default <span class="string">'28800'</span>,   `retry` int(10) unsigned default <span class="string">'7200'</span>,   `expire` int(10) unsigned default <span class="string">'604800'</span>,   `minimum` int(10) unsigned default <span class="string">'86400'</span>,   `ttl` int(10) unsigned default <span class="string">'86400'</span>,   `xfer` char(255) default NULL,   PRIMARY KEY  (`id`),   UNIQUE KEY `origin` (`origin`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=gbk;</div><div class="line"></div><div class="line">mysql&gt; show create table rr\G;</div><div class="line">*************************** 1. row ***************************</div><div class="line">       Table: rr</div><div class="line">CREATE TABLE `rr` (   `id` int(10) unsigned NOT NULL auto_increment,   `zone` int(10) unsigned NOT NULL,   `name` char(64) default NULL,   `<span class="built_in">type</span>` enum(<span class="string">'A'</span>,<span class="string">'AAAA'</span>,<span class="string">'CNAME'</span>,<span class="string">'HINFO'</span>,<span class="string">'MX'</span>,<span class="string">'NAPTR'</span>,<span class="string">'NS'</span>,<span class="string">'PTR'</span>,<span class="string">'RP'</span>,<span class="string">'SRV'</span>,<span class="string">'TXT'</span>) default NULL,   `data` char(128) default NULL,   `aux` int(10) unsigned NOT NULL,   `ttl` int(10) unsigned NOT NULL default <span class="string">'600'</span>,   `inter` tinyint(3) unsigned NOT NULL default <span class="string">'1'</span>,   `intra` tinyint(3) unsigned NOT NULL default <span class="string">'1'</span>,   PRIMARY KEY  (`id`),   KEY `name` (`name`),   KEY `rr` (`zone`,`name`,`<span class="built_in">type</span>`,`data`) ) ENGINE=MyISAM AUTO_INCREMENT=1437896 DEFAULT CHARSET=gbk;</div><div class="line"></div><div class="line">mysql&gt; select * from soa <span class="built_in">where</span> id=3;</div><div class="line">+----+--------------+--------------+---------------------+--------+---------+-------+--------+---------+-------+------+</div><div class="line">| id | origin       | ns           | mbox                | serial | refresh | retry | expire | minimum | ttl   | xfer |</div><div class="line">+----+--------------+--------------+---------------------+--------+---------+-------+--------+---------+-------+------+</div><div class="line">|  3 | example.com. | ns.example.com. | julyclyde.gmail.com |      1 |   28800 |  7200 | 604800 |   86400 | 86400 | NULL |</div><div class="line"></div><div class="line">mysql&gt; select * from rr <span class="built_in">where</span> id=1;</div><div class="line">+----+------+------+------+----------------+-----+-----+-------+-------+</div><div class="line">| id | zone | name | <span class="built_in">type</span> | data           | aux | ttl | inter | intra |</div><div class="line">+----+------+------+------+----------------+-----+-----+-------+-------+</div><div class="line">|  1 |    1 | www  | A    | 1.1.1.1 |   0 |   1 |     1 |     1 |</div><div class="line"></div><div class="line">cat  /etc/mydns.conf</div><div class="line"></div><div class="line"><span class="comment">##</span></div><div class="line"><span class="comment">##  /etc/mydns.conf</span></div><div class="line"><span class="comment">##  Wed Nov 19 10:04:14 2008</span></div><div class="line"><span class="comment">##  For more information, see mydns.conf(5).</span></div><div class="line"><span class="comment">##</span></div><div class="line"></div><div class="line"></div><div class="line">                                <span class="comment"># DATABASE INFORMATION</span></div><div class="line"></div><div class="line">db-host = localhost             <span class="comment"># SQL server hostname</span></div><div class="line">db-user = yourdbname                 <span class="comment"># SQL server username</span></div><div class="line">db-password = yourpassword          <span class="comment"># SQL server password</span></div><div class="line">database = dns                  <span class="comment"># MyDNS database name</span></div><div class="line"></div><div class="line"></div><div class="line">                                <span class="comment"># GENERAL OPTIONS</span></div><div class="line"></div><div class="line">user = nobody                   <span class="comment"># Run with the permissions of this user</span></div><div class="line">group = nobody                  <span class="comment"># Run with the permissions of this group</span></div><div class="line">listen = *                         <span class="comment"># Listen on these addresses ('*' for all)</span></div><div class="line">no-listen =                     <span class="comment"># Do not listen on these addresses</span></div><div class="line"></div><div class="line"></div><div class="line">                                <span class="comment"># CACHE OPTIONS</span></div><div class="line"></div><div class="line">zone-cache-size = 1024          <span class="comment"># Maximum number of elements stored in the zone cache</span></div><div class="line">zone-cache-expire = 60          <span class="comment"># Number of seconds after which cached zones expires</span></div><div class="line">reply-cache-size = 1024         <span class="comment"># Maximum number of elements stored in the reply cache</span></div><div class="line">reply-cache-expire = 30         <span class="comment"># Number of seconds after which cached replies expire</span></div><div class="line"></div><div class="line"></div><div class="line">                                <span class="comment"># ESOTERICA</span></div><div class="line"></div><div class="line"><span class="built_in">log</span> = /var/<span class="built_in">log</span>/mydns.log                <span class="comment"># Facility to use for program output (LOG_*/stdout/stderr)</span></div><div class="line">pidfile = /var/run/mydns.pid    <span class="comment"># Path to PID file</span></div><div class="line">timeout = 120                   <span class="comment"># Number of seconds after which queries time out</span></div><div class="line">multicpu = 4                    <span class="comment"># Number of CPUs installed on your system - (deprecated)</span></div><div class="line">servers = 2                     <span class="comment"># Number of servers to run</span></div><div class="line">recursive = 8.8.8.8                     <span class="comment"># Location of recursive resolver</span></div><div class="line">recursive-timeout =             <span class="comment"># Number of seconds before first retry</span></div><div class="line">recursive-retries =             <span class="comment"># Number of retries before abandoning recursion</span></div><div class="line">recursive-algorithm =           <span class="comment"># Recursion retry algorithm one of: linear, exponential, progressive</span></div><div class="line">allow-axfr = no                 <span class="comment"># Should AXFR be enabled?</span></div><div class="line">allow-tcp = no                  <span class="comment"># Should TCP be enabled?</span></div><div class="line">allow-update = no               <span class="comment"># Should DNS UPDATE be enabled?</span></div><div class="line">ignore-minimum = no             <span class="comment"># Ignore minimum TTL for zone?</span></div><div class="line">soa-table = soa                 <span class="comment"># Name of table containing SOA records</span></div><div class="line">rr-table = rr                   <span class="comment"># Name of table containing RR data</span></div><div class="line">use-soa-active = no             <span class="comment"># Use the soa active attribute if provided</span></div><div class="line">use-rr-active = no              <span class="comment"># Use the rr active attribute if provided</span></div><div class="line">notify-enabled = no             <span class="comment"># Enable notify from updates</span></div><div class="line">notify-source = 0.0.0.0         <span class="comment"># Source address for ipv4 notify messages</span></div><div class="line">notify-source6 = 0.0.0.0        <span class="comment"># Source address for ipv6 notify messages</span></div><div class="line">notify-timeout = 60             <span class="comment"># Number of seconds before first retry</span></div><div class="line">notify-retries = 5              <span class="comment"># Number of retries before abandoning notify</span></div><div class="line">notify-algorithm = linear       <span class="comment"># Notify retry algorithm one of: linear, exponential, progressive</span></div><div class="line">ixfr-enabled = no               <span class="comment"># Enable IXFR functionality</span></div><div class="line">ixfr-gc-enabled = no            <span class="comment"># Enable IXFR GC functionality</span></div><div class="line">ixfr-gc-interval = 86400        <span class="comment"># How often to run GC for IXFR</span></div><div class="line">ixfr-gc-delay = 600             <span class="comment"># Delay until first IXFR GC runs</span></div><div class="line">extended-data-support = no      <span class="comment"># Support extended data fields for large TXT records</span></div><div class="line">dbengine = MyISAM               <span class="comment"># Support different database engines</span></div><div class="line">wildcard-recursion = 0          <span class="comment"># Wildcard ancestor search levels</span></div><div class="line">soa-where =                     <span class="comment"># Extra WHERE clause for SOA queries</span></div><div class="line">rr-where =    inter=1                   <span class="comment"># Extra WHERE clause for RR queries</span></div></pre></td></tr></table></figure>
<h2 id="6-启动"><a href="#6-启动" class="headerlink" title="6.启动"></a>6.启动</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">/etc/init.d/mydns start</div></pre></td></tr></table></figure>

	

	
		<span class="different-posts"><a href="/2017/10/12/Dns、Iredmaill/4. mydns安装配置/" onclick="window.history.go(-1); return false;">⬅️ Go back </a></span>

	

</article>

	</main>

	<footer class="footer">
	<div class="footer-content">
		
	      <div class="footer__element">
	<p>Hi there, <br />welcome to my Blog glad you found it. Have a look around, will you?</p>
</div>

	    
	      <div class="footer__element">
	<h5>Check out</h5>
	<ul class="footer-links">
		<li class="footer-links__link"><a href="/archives">Archive</a></li>
		
		  <li class="footer-links__link"><a href="/atom.xml">RSS</a></li>
	    
		<li class="footer-links__link"><a href="/about">about page</a></li>
		<li class="footer-links__link"><a href="/tags">Tags</a></li>
		<li class="footer-links__link"><a href="/categories">Categories</a></li>
	</ul>
</div>

	    

		<div class="footer-credit">
			<span>© 2017 失落的乐章 | Powered by <a href="https://hexo.io/">Hexo</a> | Theme <a href="https://github.com/HoverBaum/meilidu-hexo">MeiliDu</a></span>
		</div>

	</div>


</footer>



</body>

</html>
